<?php

namespace app\common\validate;

use think\Validate;

class UploadValidate extends Validate
{
    /**
     * 定义验证规则
     * 格式：'字段名'	=>	['规则1','规则2'...].
     *
     * @var array
     */
    protected $rule = [
        'img_file|上传文件' => 'file|fileExt:jpg,png,jpeg',
        'code|资源标识' => 'require|length:32',
    ];

    /**
     * 定义错误信息
     * 格式：'字段名.规则名'	=>	'错误信息'.
     *
     * @var array
     */
    protected $message = [];
    protected $scene = [
        'uploadImg' => ['img_file'],
        'uploadFile' => ['file' => 'file'],
        'setResourceStatus' => ['code'],
    ];
}
